@php
    $oneDayOrder=\App\OrderPay::where('create_time','>',\Carbon\Carbon::yesterday())->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->select(\Illuminate\Support\Facades\DB::raw('count(DISTINCT user_id) as num'))->first();
        $threeDayOrder=\App\OrderPay::where('create_time','>',\Illuminate\Support\Carbon::today()->addDays(-3))->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->select(\Illuminate\Support\Facades\DB::raw('count(DISTINCT user_id) as num'))->first();;
        $sevenDayOrder=\App\OrderPay::where('create_time','>',\Illuminate\Support\Carbon::today()->addDays(-7))->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->select(\Illuminate\Support\Facades\DB::raw('count(DISTINCT user_id) as num'))->first();
        $mouthOrder=\App\OrderPay::where('create_time','>',\Illuminate\Support\Carbon::today()->addDays(-30))->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->select(\Illuminate\Support\Facades\DB::raw('count(DISTINCT user_id) as num'))->first();;
        $totalOrder=\App\OrderPay::select(\Illuminate\Support\Facades\DB::raw('count(DISTINCT user_id) as num'))->where('closed','!=',true)->where('refund_status','!=',\App\OrderPay::REFUND_STATUS_APPLIED)->first();
        $varOrder= json_encode([$oneDayOrder->num,$threeDayOrder->num,$sevenDayOrder->num,$mouthOrder->num,$totalOrder->num]);
@endphp

<div id="userOrder" style="width: 600px;height:400px;"></div>
<script>

    $(function () {

        var data ={{$varOrder}};


        var myChart1 = echarts.init(document.getElementById('userOrder'));
        var option = {
            title: {
                text: '会员活跃度统计'

            },
            tooltip: {},
            legend: {
                data: ['下单会员数']
            },
            xAxis: {
                data: ["前一天","前三天","前七天", "前三十天", '当前']
            },
            yAxis: {},
            series: [{
                name: '下单会员数',
                type: 'bar',
                data: data
            }],
            color:['#3c8dbc']
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart1.setOption(option);
    })
</script>